package com.shujia.scala

object Demo21Thread {
  def main(args: Array[String]): Unit = {

    new MyThread().start()

    val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9)


    for (elem <- list) {

      println("main:" + elem)

      Thread.sleep(1000)

    }

  }
}


class MyThread extends Thread {
  override def run(): Unit = {


    val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9)


    for (elem <- list) {

      println("MyThread:" + elem)

      Thread.sleep(1000)

    }

  }
}

